<template>
  <div class="bgcontainer">
    <div class="background loaded"></div>
    <div class="topbanner">
      <div class="poswrap">
        <h1>{{ site.title }} - {{ site.desc }}</h1>
      </div>
    </div>
    <div class="loginbox">
      <el-form ref="form" :model="form" label-width="">
        <el-form-item label="">
          <el-input v-model="form.name" placeholder="用户名，点左下角按钮可以直接用测试账号" prefix-icon="el-icon-user"></el-input>
        </el-form-item>
        <el-form-item label="">
          <el-input v-model="form.password" placeholder="密码，点左下角按钮可以直接用测试账号" prefix-icon="el-icon-lock" show-password></el-input>
        </el-form-item>
        <el-form-item>
          <el-button class="loginbtn" size="large" @click="onSubmit">登录</el-button>
        </el-form-item>
        <el-form-item class="btnRegisterWrapper">
          <router-link to="/account/register" class="btnFooter">注册账号</router-link>
          <router-link to="/account/forget" class="btnFooter">忘记密码</router-link>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      loading: false,
      form: {
        name: '',
        password: '',
      },
    }
  },
  computed: {
    site () { return this.$store.state.site },
  },
  methods: {
    onSubmit () {
      // do sth here
    },
  },
}
</script>
<style lang="scss">
  .btnRegisterWrapper {
    display: block;
    margin-top: -8px;
    margin-bottom: 12px;
    .el-form-item__content {
      display: flex;
      align-items: center;
      justify-content: space-between;
      line-height: 1.8;
      &:before, &:after {
        content: none;
      }
    }
    .btnFooter {
      display: inline-block;
      color: #ffffff;
      text-decoration: none;
      cursor: pointer;
      user-select: none;
    }
  }

  div.background {
    opacity: 0;
    display: block;
    background: #f0f2f5 url('../../assets/bg.svg') scroll no-repeat center 110px;
    background-size: 100%;
    position: absolute;
    z-index: -1;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    transition: opacity .5s ease;
  }

  div.background.loaded {
    opacity: 1;
  }
  .topbanner {
    width: 100%;
    height: 220px;
    color: #dedede;
    background-position: center bottom;
    background-size: cover;
    position: relative;
  }

  .topbanner .poswrap {
    position: absolute;
    width: 100%;
    bottom: 25px;
    text-align: center;
    h1 {
      font-weight: 600;
      font-size: 33px;
      color: rgba(0, 0, 0, .85);
      font-family: Avenir,"Helvetica Neue",Arial,Helvetica,sans-serif;
    }
  }
  .bgcontainer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
  }

  .loginbox {
    width: 480px;
    padding: 40px 40px 0;
    background-color: rgba(152, 152, 152, .6);
    border-radius: 5px;
    box-sizing: border-box;
    margin: 0 auto;
    overflow: hidden;
  }

  .loginbtn {
    width: 100%;
    margin-bottom: 0;
    padding: 12px;
    line-height: 20px;
    font-size: 18px;
    display: inline-block;
    outline: 0;
    border-radius: 3px;
    position: relative;
    border: 1px solid lighten(#3790ff, 10%);
    background-color: lighten(#3790ff, 10%);
    color: #fff;
    font-weight: 700;
    transition: padding-right 218ms ease;
    &:hover {
      color: #fff;
      border-color: #40a9ff;
      background-color: #40a9ff;
    }
  }
</style>
